#ifndef PICTUREITEM_H
#define PICTUREITEM_H

#include <QObject>
#include <QPixmap>
#include <QGraphicsItem>
#include <QGraphicsPixmapItem>
#include <QGraphicsObject>

class pictureItem : public QGraphicsObject
{
    Q_OBJECT
private:
    int id;
    int type;
    bool isPressed;
    qreal pointPercent;//?????????????????????????
    QPixmap p_pixmap;
    Qt::TransformationMode mode;
    QPointF pressedPoint;
    QPointF offset;
    QPointF position;//?????????????????????????

public:
    explicit pictureItem(QGraphicsObject *parent = nullptr);
    explicit pictureItem(const QPixmap &pixmap, QGraphicsObject *parent = nullptr);

    int getId()const;
    void setId(int id);
    int getType()const;
    void setType(int type);
    QPointF getOffset()const;
    void setOffset(const QPointF &offset);
    QPixmap getPixmap()const;
    void setPixmap(const QPixmap &pixmap);
    void setTransformationMode(Qt::TransformationMode mode);

    virtual QRectF boundingRect() const;

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

signals:
    void clicked();
    void clickedId(int);
};

#endif // PICTUREITEM_H
